package com.intellagric.dao.agritech;

import com.intellagric.module.agritech.AgtResourceVo;
import com.intellagric.pojo.AgtResource;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author: cwq
 * @Date: 2019/2/23 13:23
 * @Description:
 */
public interface AgtResourceDao {
    List<AgtResource> selectResourceListByVo(AgtResourceVo agtResourceVo);

    @Update({"update agt_resource set like_count = like_count + (#{addend}) where id = #{id}"})
    int increaseResourceLikeCount(@Param("id") String resourceId, @Param("addend")int addent);

    @Update({"update agt_resource set star_count = star_count + (#{addend}) where id = #{id}"})
    int increaseResourceStarCount(@Param("id") String resourceId, @Param("addend")int addent);

    @Update({"update agt_resource set comment_count = comment_count + (#{addend}) where id = #{id}"})
    int increaseResourceCommentCount(@Param("id") String resourceId, @Param("addend")int addent);

}
